# 作者: 陈其志 
# 2025年02月19日09时38分44秒 
# 2716847110@qq.com

def bian_li(str_1):
    """
    遍历字符串
    :param str_1:
    :return:
    """
    for i in str_1:
        print(i, end='')


def str_replace(str_1, str_2, str_3):
    """
    在str_1中用str_3替换str_2
    :param str_1:
    :param str_2:
    :param str_3:
    :return:  返回替换后的字符串
    """
    return str_1.replace(str_2, str_3)spilt



def str_find(str_1, str_2):
    """
    找到第一个字符串中第二个字符串的index
    :param str_1:
    :param str_2:
    :return: 返回index
    """
    return str_1.find(str_2)


def str_reverse(str_1):
    """
    字符串逆序
    :param str_1:
    :return:
    """
    #
    list_1 = list(str_1)
    list_1.reverse()
    return ''.join(list_1)


def str_join(str_1, str_2):
    """
    以 string 作为分隔符，将 seq 中所有的字符以 string 分割开列表变为字符串
    :param str_1:
    :param str_2:
    :return:
    """
    str_result = str_1.join(str_2)
    return str_result


if __name__ == '__main__':
    str_test = 'hello world!'
    # bian_li(str_test)
    # print(str_find(str_test, 'world'))
    # print(str_replace(str_test, 'world', 'python'))
    print(str_reverse(str_test))
    # str_11 = 'hello world hello python'
    # print(str_11.split())  # 默认按空格分割
    # str_22 = 'hello\n world hello\npython'
    # print(str_22.splitlines())  # 按行分割   要来分割文档
    # str_33 = 'hello world, hello python'
    # print(str_33.split(','))  # 按照逗号分割
    # print(str_join(',', str_test))
